﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SingletonPattern
{
    /// <summary>
    /// Lazy<T> type
    /// </summary>
    /// <remarks>
    /// 这种方式的简单和性能良好，而且还提供检查是否已经创建实例的属性IsValueCreated。
    /// </remarks>
    public sealed class LazyTSingleton
    {
        private static readonly Lazy<LazyTSingleton> _lazy =
            new Lazy<LazyTSingleton>(() => new LazyTSingleton());

        public static LazyTSingleton Instance { get { return _lazy.Value; } }

        private LazyTSingleton()
        {
        }
    }
}
